package lab02.test03;

import com.sun.org.apache.regexp.internal.RE;

/**
 * Created by 14394 on 2017/10/15.
 */
public class Student {
    private float computer_scores;
    private float math_scores;
    private float English_scores;

    public Student(float computer_scores, float math_scores, float English_scores) {
        this.computer_scores = computer_scores;
        this.math_scores = math_scores;
        this.English_scores = English_scores;
    }

    public float getComputer_scores() {
        return computer_scores;
    }

    public void setComputer_scores(float computer_scores) {
        this.computer_scores = computer_scores;
    }

    public float getMath_scores() {
        return math_scores;
    }

    public void setMath_scores(float math_scores) {
        this.math_scores = math_scores;
    }

    public float getEnglish_scores() {
        return English_scores;
    }

    public void setEnglish_scores(float English_scores) {
        this.English_scores = English_scores;
    }

    public float getTotalScore(){
        return computer_scores+math_scores+English_scores;
    }

    public float getAverageScore(){
        return (computer_scores+math_scores+English_scores)/3;
    }

    public float getMaxScore(){
        float m=0.0f;
        if (computer_scores>math_scores){
            m=computer_scores;
            if (m>=English_scores){
                return m;
            }
        }else {
            m=math_scores;
            if (m>=English_scores){
                return m;
            }
        }
        return m;
    }

    public float getMinScore(){
        float s = 0.0f;
        if (computer_scores>math_scores){
            s=math_scores;
            if (s>English_scores){return English_scores;}
        }else {
            if (computer_scores<math_scores){
                s=computer_scores;
                if (s<English_scores) return s;
            }
        }
        return s;
    }

    @Override
    public String toString() {
        System.out.println("ihaverun");
        return "该学生的成绩分别是计算机："+getComputer_scores()+"数学："+getMath_scores()+"英语："+English_scores+"其中最高分："+
                getMaxScore()+"最低分："+getMinScore();
    }
}
